﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HouseAgencySite.Utils
{
    public class GmailSending : EmailSenderBase
    {

        public string Account { get; set; }
        public string Password { get; set; }
        public string To { get; set; }

        protected override void ParseSetUpXml(System.Xml.Linq.XElement element)
        {
            var gmail = element.Element("Gmail");
            if (gmail == null)
                throw new SetUpException("Gmail element is missing");

            Account = gmail.Element("Account").Value;
            Password = gmail.Element("Password").Value;
            To = gmail.Element("To").Value;
        }


        public void SimpleSendShouldSucceed()
        {
            var g = new GmailSender(Account, Password);
            g.Send(Account, To, "TEST: gmail test message", "test message body");
        }
    }

}